package com.tudouji.project.copy.controller;

import java.util.List;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.tudouji.framework.aspectj.lang.annotation.Log;
import com.tudouji.framework.aspectj.lang.enums.BusinessType;
import com.tudouji.project.copy.domain.Kdsynparamcomp;
import com.tudouji.project.copy.service.IKdsynparamcompService;
import com.tudouji.framework.web.controller.BaseController;
import com.tudouji.framework.web.domain.AjaxResult;
import com.tudouji.common.utils.poi.ExcelUtil;
import com.tudouji.framework.web.page.TableDataInfo;

/**
 * 参数对照Controller
 * 
 * @author tudouji
 * @date 2021-01-21
 */
@RestController
@RequestMapping("/copy/KdSynParamComp")
public class KdsynparamcompController extends BaseController
{
    @Autowired
    private IKdsynparamcompService kdsynparamcompService;

    /**
     * 查询参数对照列表
     */
    @PreAuthorize("@ss.hasPermi('copy:KdSynParamComp:list')")
    @GetMapping("/list")
    public TableDataInfo list(Kdsynparamcomp kdsynparamcomp)
    {
        startPage();
        List<Kdsynparamcomp> list = kdsynparamcompService.selectKdsynparamcompList(kdsynparamcomp);
        return getDataTable(list);
    }

    /**
     * 导出参数对照列表
     */
    @PreAuthorize("@ss.hasPermi('copy:KdSynParamComp:export')")
    @Log(title = "参数对照", businessType = BusinessType.EXPORT)
    @GetMapping("/export")
    public AjaxResult export(Kdsynparamcomp kdsynparamcomp)
    {
        List<Kdsynparamcomp> list = kdsynparamcompService.selectKdsynparamcompList(kdsynparamcomp);
        ExcelUtil<Kdsynparamcomp> util = new ExcelUtil<Kdsynparamcomp>(Kdsynparamcomp.class);
        return util.exportExcel(list, "KdSynParamComp");
    }

    /**
     * 获取参数对照详细信息
     */
    @PreAuthorize("@ss.hasPermi('copy:KdSynParamComp:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return AjaxResult.success(kdsynparamcompService.selectKdsynparamcompById(id));
    }

    /**
     * 新增参数对照
     */
    @PreAuthorize("@ss.hasPermi('copy:KdSynParamComp:add')")
    @Log(title = "参数对照", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody Kdsynparamcomp kdsynparamcomp)
    {
        return toAjax(kdsynparamcompService.insertKdsynparamcomp(kdsynparamcomp));
    }

    /**
     * 修改参数对照
     */
    @PreAuthorize("@ss.hasPermi('copy:KdSynParamComp:edit')")
    @Log(title = "参数对照", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody Kdsynparamcomp kdsynparamcomp)
    {
        return toAjax(kdsynparamcompService.updateKdsynparamcomp(kdsynparamcomp));
    }

    /**
     * 删除参数对照
     */
    @PreAuthorize("@ss.hasPermi('copy:KdSynParamComp:remove')")
    @Log(title = "参数对照", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(kdsynparamcompService.deleteKdsynparamcompByIds(ids));
    }
}
